/*
 ============================================================================
 Name		: CelestialSphereAppView.h
 Author	  : Den Grigorenko
 Copyright   : Copyright (c) 2008 Den123
 Description : Declares view class for application.
 ============================================================================
 */

#ifndef __CELESTIALSPHEREAPPVIEW_h__
#define __CELESTIALSPHEREAPPVIEW_h__

// INCLUDES
#include <coecntrl.h>
#include <lbssatellite.h> 
#include "Magnetic.h"

class CSputnikDrawer;
class CSputnikBarDrawer;
class SFontData;
class CSensorFinder;

// CLASS DECLARATION
class CCelestialSphereAppView : public CCoeControl, public MMagneticReader
{
public:
	// New methods

	/**
	 * NewL.
	 * Two-phased constructor.
	 * Create a CCelestialSphereAppView object, which will draw itself to aRect.
	 * @param aRect The rectangle this view will be drawn to.
	 * @return a pointer to the created instance of CCelestialSphereAppView.
	 */
	static CCelestialSphereAppView* NewL(const TRect& aRect);

	/**
	 * NewLC.
	 * Two-phased constructor.
	 * Create a CCelestialSphereAppView object, which will draw itself
	 * to aRect.
	 * @param aRect Rectangle this view will be drawn to.
	 * @return A pointer to the created instance of CCelestialSphereAppView.
	 */
	static CCelestialSphereAppView* NewLC(const TRect& aRect);

	/**
	 * ~CCelestialSphereAppView
	 * Virtual Destructor.
	 */
	virtual ~CCelestialSphereAppView();

	void Update( TPositionSatelliteInfo& aData );
	void UpdateError( TInt aError );

public:
	// Functions from base classes

	/**
	 * From CCoeControl, Draw
	 * Draw this CCelestialSphereAppView to the screen.
	 * @param aRect the rectangle of this view that needs updating
	 */
	void Draw(const TRect& aRect) const;

	/**
	 * From CoeControl, SizeChanged.
	 * Called by framework when the view size is changed.
	 */
	virtual void SizeChanged();

protected: // MMagneticReader
    void DataReceivedL(TInt aAngle, TInt aAccuracyLevel);


private:
	// Constructors

	/**
	 * ConstructL
	 * 2nd phase constructor.
	 * Perform the second phase construction of a
	 * CCelestialSphereAppView object.
	 * @param aRect The rectangle this view will be drawn to.
	 */
	void ConstructL(const TRect& aRect);

	/**
	 * CCelestialSphereAppView.
	 * C++ default constructor.
	 */
	CCelestialSphereAppView();


private:
    CSensorFinder* iFinder;
	TPositionSatelliteInfo iSatData;
	
    HBufC* iWaitStr;
	SFontData* iFontData;
	CSputnikDrawer* iSputnikDrawer;
	CSputnikBarDrawer* iSputnikBarDrawer;
};

#endif // __CELESTIALSPHEREAPPVIEW_h__
// End of File
